import React, { useEffect, useState } from 'react'
import { getList, getXq } from '../../api/us'
import { useLocale } from 'antd/es/locale'
import { useLoaderData } from 'react-router-dom'
const Index = () => {
    const lo=useLoaderData()
    const [list,setList]=useState(lo.list.rows)
    console.log(list);
    
    return (
        <div>
            {
                list&&list.map((item,i)=>(
                    <span key={i}>{item.content}</span>
                ))
            }
        </div>
    )
}

export default Index
export const loader = async ({ request }) => {
    const url = new URL(request.url)
    const sp = Object.fromEntries(url.searchParams)
    const res=await getList(sp.id)
    return {
        list:res
    }
}
